<ui:composition template="/template/twocolumn2.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="conteudo">
		<h3>Consulta de Professor</h3>
		<h:form id="form">
			<h:messages style="color:red" />

			<p:dataTable value="#{professorMB.professores}" var="professor"
				paginator="false" rows="10"
				paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks}
					{NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15" style="width: 100%" lazy="true">

				<p:column>
					<f:facet name="header">#{Message['label.usuario.matricula']}</f:facet>
					<h:outputText value="#{professor.matricula}" />
				</p:column>
				<p:column>
					<f:facet name="header">#{Message['label.usuario.nome']}</f:facet>
					<h:outputText value="#{professor.nome}" />
				</p:column>
				      <p:column>
                         <f:facet name="header">#{Message['label.usuario.email']}</f:facet>
                         <h:outputText value="#{professor.email}" />
                    </p:column>
                    <p:column>
                         <f:facet name="header">#{Message['label.usuario.status']}</f:facet>
                         <h:outputText value="#{professor.statusUsuario.valor}" />
                    </p:column>
                            <p:column>
                    <f:facet name="header">Dados</f:facet>
                    <p:commandButton id="selectButton" update=":form:display"
                        oncomplete="PF('carDialog').show()" icon="ui-icon-search"
                        title="View">
                        <f:setPropertyActionListener value="#{professor}"
                            target="#{professorMB.professor}" />
                    </p:commandButton>
                </p:column>
				<p:column style="width:4%">
					<h:commandButton id="alterButton" action="#{professorMB.paginaAlterarProfessor}" 
					value="Editar" title="View">
						<f:setPropertyActionListener value="#{professor}"
							target="#{professorMB.professor}" />
					</h:commandButton>
				</p:column>
			</p:dataTable>
			
			 <p:dialog header="#{professorMB.professor.nome}" widgetVar="carDialog" width="300" resizable="true" id="carDlg"  
                showEffect="fade" hideEffect="explode" modal="true" >  
  
        <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;">  
            <h:outputText value="CPF:" />  
            <h:outputText value="#{professorMB.professor.cpf}" style="font-weight:bold"/>  
  
            <h:outputText value="Telefone:" />  
            <h:outputText value="#{professorMB.professor.telefone}" style="font-weight:bold"/>  
            
            <h:outputText value="Edereço:" />  
            <h:outputText value="#{professorMB.professor.endereco}" style="font-weight:bold"/>  
            
            <h:outputText value="Cidade:" />  
            <h:outputText value="#{professorMB.professor.cidade}" style="font-weight:bold"/>  
            
            <h:outputText value="UF:" />  
            <h:outputText value="#{professorMB.professor.uf}" style="font-weight:bold"/>  
            
            <h:outputText value="Disciplinas: " />  
            <ui:repeat var="dis" value="#{professorMB.professor.disciplinas}">
            <h:outputText value="#{dis.nome}" style="font-weight:bold"/>  
            </ui:repeat>
        </h:panelGrid>  
  
    </p:dialog>  
		</h:form>
	</ui:define>
</ui:composition>
